<?php
namespace app\admin\model;

use think\facade\Db;
use think\Model;

//属性页
class GoodsProp extends Model{
    //属性页查询语句
    public static function   propList($where,$whereOr){
        $prop=GoodsProp::
            field('pid,pname,pvalues,sort_order,xiaoguo')
            ->where($where)
            ->where(function ($query) use($whereOr){
                $query->whereOr($whereOr);
            })
            ->select()->toArray();
        return $prop;
    }
    //属性页values复选框
    public static function   propValues(){
        $pvalues=GoodsProp::suffix('_value')
            ->field("vid,pid,prop_value")
            ->select()->toArray();
        return $pvalues;
    }
 public static function   propOne($s){
     $pvalues=GoodsProp::suffix('_value')->where('vid','=',$s)->value('prop_value');

     return $pvalues;
     }

    public static function   getXiaoguoAttr($v,$data){
        if ($data['xiaoguo']==1){
            return '<font color="#00CC99">有效</font>';
        }else{
            return '<font color="#CE3E3E">无效</font>';
        }
    }


}
